//
//  YNSMineTableCell.m
//  HNBaseProject
//
//  Created by xujie on 2024/6/23.
//

#import "YNSMineTableCell.h"

@implementation YNSMineTableCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createUI];
    }
    return self;
}

- (void)createUI {
    self.selectionStyle = 0;
    self.backgroundColor = [UIColor colorWithHexString:@"#F7F8FA"];
    
    self.bgView = [[UIView alloc] initWithFrame:CGRectMake(10, 0, kScreenW-20, 64)];
    self.bgView.backgroundColor = [UIColor whiteColor];
    self.bgView.layer.cornerRadius = 8;
    self.bgView.layer.masksToBounds = YES;
    [self.contentView addSubview:self.bgView];
    
    self.icon = [[UIImageView alloc] init];
    [self.bgView addSubview:self.icon];
    [self.icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.mas_equalTo(29);
        make.left.offset(15);
        make.centerY.mas_equalTo(self.bgView);
    }];
    
    self.nameLab = [[UILabel alloc] init];
    [self.bgView addSubview:self.nameLab];
    self.nameLab.textColor = [UIColor colorWithHexString:@"#212423"];
    self.nameLab.font = PFRFontMedium(16);
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(57);
        make.centerY.mas_equalTo(self.bgView);
    }];
    
    self.rightImageV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_com_right"]];
    [self.bgView addSubview:self.rightImageV];
    [self.rightImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.bgView);
        make.right.offset(-12);
        make.width.mas_equalTo(6);
        make.height.mas_equalTo(10);
    }];
}

- (void)reloadCellWithIcon:(NSString *)iconName title:(NSString *)title {
    self.icon.image = [UIImage imageNamed:iconName];
    self.nameLab.text = title;
}

@end
